<!--
 * @Description: What's this for
 * @Autor: WangYuan
 * @Date: 2022-03-23 10:01:33
 * @LastEditors: WangYuan
 * @LastEditTime: 2022-03-28 17:14:37
-->
<template>
  <KiFormDialog :show.sync="dialogVisible" title="退款记录">
    <div v-if="info" class="text-18px" v-loading="loading">
      <!-- 实物退款图片 -->
      <div v-if="info.imageUrl">
        <p class="text-grey">{{ info.refundApplyTime }}</p>
        <Imgpond v-model="info.imageUrl" disabled />
      </div>

      <!-- 退款记录 -->
      <el-timeline>
        <el-timeline-item
          v-for="(item, i) in timeline"
          :key="i"
          :timestamp="item.operateTime"
          placement="top"
        >
          <el-card>
            <h4 class="mt-0">{{ item.title }}</h4>
            <div>{{ item.content }}</div>
          </el-card>
        </el-timeline-item>
      </el-timeline>
    </div>
  </KiFormDialog>
</template>
<script>
import API from './api'
export default {
  components: {
  },
  data () {
    return {
      dialogVisible: false,
      loading: false,
      info: null,
      timeline: []
    }
  },
  methods: {
    open (row) {
      this.info = row.refundApply
      this.timeline = []
      this.dialogVisible = true
      this.$forceUpdate()

      this.loading = true
      API.queryRefundApplyHistory({
        refundId: this.info.refundId
      })
        .then(({ data }) => {
          this.timeline = data
        })
        .finally(_ => {
          this.loading = false
        })
    }
  }
}
</script>
